import { ProTableProps } from '@ant-design/pro-components';
import { RoleType } from '@/types/role';

export const roleTableConfig: ProTableProps<RoleType, any> = {
  rowKey: 'id',
  // headerTitle='高级表格'
  search: {
    labelWidth: 'auto',
  },
  options: {
    setting: {
      listsHeight: 400,
    },
  },
  columnsState: {
    // 持久化储存
    persistenceKey: 'roleManager',
    persistenceType: 'localStorage',
  },
  cardBordered: true,
  dateFormatter: 'string',
  pagination: {
    defaultPageSize: 10,
    showSizeChanger: true,
  },
  columns: [
    {
      title: '编号',
      dataIndex: 'index',
      valueType: 'indexBorder',
      width: 48,
    },
    {
      title: '角色',
      dataIndex: 'name',
      copyable: true,
      ellipsis: true,
      filters: true,
      disable: true,
      formItemProps: {
        rules: [
          {
            required: false,
            message: '此项为必填项',
          },
        ],
      },
    },
    {
      title: '角色标识',
      dataIndex: 'sole',
      editable: false,
      search: false,
    },
    {
      title: '备注',
      dataIndex: 'memo',
      search: false,
      ellipsis: true,
    },
    {
      title: '创建时间',
      dataIndex: 'createTime',
      valueType: 'dateTime',
      editable: false,
      search: false,
    },
    {
      title: '修改时间',
      dataIndex: 'updatedTime',
      valueType: 'dateTime',
      editable: false,
      search: false,
    },
    {
      title: '操作',
      valueType: 'option',
      key: 'option',
      disable: true,
    },
  ],
};
